<template>
  <div class="main-page">
    <div class="main-content">
      <div class="shenfen">请选择您的身份</div>
      <div
        class="yindao"
        @click="goGuide"
      >
        <a style="display: flex;align-items: center;justify-content: center">
          <img
            style="height: 25px;width: 25px;margin-right: 5px"
            src="/static/images/pinduoduo.png"
          />
          拼多多商家
        </a>
      </div>
      <!-- <div
        class="yindao"
        @click="login"
      ><a>线下商家</a></div> -->
      <toast ref="toast" />
    </div>
  </div>
</template>

<script>
import api from "@/utils/api";
import toast from "@/components/toast";

//首页身份选择
export default {
  components: {
    toast
  },

  data() {
    return {};
  },

  created() {},

  mounted() {},

  methods: {
    goGuide() {
      var _this = this;
      var openId = wx.getStorageSync("openId");
      //获取链接地址
      wx.request({
        url: api.pdd + "?ecstoken=" + wx.getStorageSync("sessionId"),
        data: {
          openId: openId
        },
        method: "POST",
          header: {
              'Content-Type': 'application/x-www-form-urlencoded',
              ecstoken : wx.getStorageSync('sessionId'),
              fslb : wx.getStorageSync('fslb')
          },
        success(res) {
          try {
            wx.setStorageSync("guideUrl", res.data.data);
            var url = "../guide/main";
            mpvue.navigateTo({ url });
          } catch (e) {}
        },
        fail() {
          _this.$refs.toast.show("网络异常");
        }
      });
    },
    goMenu() {
      var url = "../menu/main";
      mpvue.navigateTo({ url });
    },
    login() {
      // this.$refs.toast.show("尽请期待");
      var url = "../login/main";
      mpvue.navigateTo({ url });
    }
  }
};
</script>

<style lang="wxss">
page {
  width: 100%;
  height: 100%;
  text-align: center;
  background-color: #f7fbff;
}
</style>

<style scoped>
.main-page {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  margin-left: auto;
  margin-right: auto;
}
.main-page .main-content {
  width: 100%;
  margin-top: -1.7rem;
}

.shenfen {
  margin-top: 1.1rem;
  margin-bottom: 0.6rem;
  font-size: 15px;
  font-family: PingFang SC;
  font-weight: 500;
  color: rgba(163, 170, 183, 1);
  line-height: 13px;
}

.yindao {
  padding-left: 10%;
  padding-right: 10%;
  margin-bottom: 0.5rem;
  height: 40px;
  width: 80%;
}

.yindao a {
  height: 100%;
  color: #373e4f;
  background-color: #ffffff;
  box-shadow: 0px 1px 6px 0px rgba(0, 119, 255, 0.16);
  border-radius: 40px;
  line-height: 40px;
  font-size: 15px;
  font-family: PingFang SC;
  font-weight: 500;
  color: rgba(55, 62, 79, 1);
  text-align: center;
  vertical-align: middle;
}
</style>
